<template>
  <el-container>
    <el-header>
      <div class="headerdiv">
        酒店点餐管理系统
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <el-button type="primary" @click="exit">退出</el-button>
      </div>
    </el-header>
    <el-container>
      <el-aside width="200px">
        <el-menu
          default-active="2"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose">

          <el-menu-item index="1" @click="tointroduction">
            <i class="el-icon-apple"></i>
            <span slot="title">酒店简介</span>
          </el-menu-item>

          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-s-custom"></i>
              <span >用户管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="2-1" @click="topasswordupdate">密码修改</el-menu-item>
<!--              <el-menu-item index="2-2" @click="exit">退出登陆</el-menu-item>-->
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-setting"></i>
              <span >菜单管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="3-1"  @click="tomenu">菜谱</el-menu-item>
<!--              <el-menu-item index="3-2"  @click="tofoodinsert">添加菜品</el-menu-item>-->
            </el-menu-item-group>
          </el-submenu>


          <el-menu-item index="4" @click="tohistory">
            <i class="el-icon-location"></i>
            <span slot="title">历史记录</span>
          </el-menu-item>

<!--          <el-menu-item index="5" @click="tobill">-->
<!--            <i class="el-icon-reading"></i>-->
<!--            <span slot="title">账单管理</span>-->
<!--          </el-menu-item>-->

        </el-menu>
      </el-aside>
      <el-main>

        <router-view></router-view>
      </el-main>
    </el-container>

  </el-container>
</template>

<script>

  import {logout} from "@/network/form";

  export default {
    name: "Main",
    components: {},
    methods: {
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },
      topasswordupdate(){
        this.$router.push('/form/childcomps/information')
      },
      tomenu(){
        this.$router.push('/form/childcomps/menu')
      },
      tofoodinsert(){
        this.$router.push('/form/childcomps/foodinsert')
      },
      tohistory(){
        this.$router.push('/form/childcomps/history')
      },
      tointroduction(){
        this.$router.push('/form/childcomps/introduction')
      },
      tobill(){
        this.$router.push('/form/childcomps/bill')
      },
      exit (){
        this.$confirm('此操作将退出该系统, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$message({
            type: 'success',
            message: '退出成功!'
          });
          localStorage.removeItem("Authorization"),
          this.$router.push("/form/login")
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消退出'
          })

        })
      }

    }
  }
</script>

<style scoped>
  .el-header {
    background-color: #B3C0D1;
    color: #333;
    /*text-align: center;*/
    line-height: 60px;
  }

  .el-aside {
    background-color: #D3DCE7;
    color: #333;
    text-align: center;
    line-height: 200px;
  }

  .el-main {
    color: #333;
    height: 780px;
  }
  .headerdiv{
    /*background: #04bdb9;*/
    width: 1500px;
    height: 50px;
    margin-left: 100px;
    font-size: 20px;

    float: left;
  }

  .headerimage{
    width: 400px;
    height: 60px;
    margin-left: 100px;
    font-size: 20px;
    background-color: #dd6161;
    float: right;

  }
  .image{
    width: 60px;
    height: 60px;
  }
</style>
